package Runde3;

public class EquilateralTriangle implements RegularPolygon {

	private double a;
	
	//Creates a new EquilateralTriangle; a>0
	public EquilateralTriangle(double a) {
		
		this.a = a;
	}

	//Sets the 	EquilateralTriangle's side-lengths with to the given length; length > 0
	public void set(double length) {
		a = length;
	}

	//Scales the EquilateralTriangle's size by the given factor; factor > 0
	public void scale(double factor) {
		a *= factor;
	}

	//Returns the EquilateralTriangle's area
	public double area() {
		
		return ((a*a)*Math.sqrt(3))/4;
	}

	//Returns the EquilateralTriangle's perimeter
	public double perimeter() {
		return 3*a;
	}

	//Returns the EquilateralTriangle's amount of edges (3)
	public int edges() {
		return 3;
	}

}
